package com.example.user.controller;

import com.example.albumtype.mapper.AlbumtypeMapper;
import com.example.photomessage.mapper.PhotoMapper;
import com.example.file.util.FileUtil;
import com.example.user.entity.User;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;


/**
 * @author 贾明祯
 * @ClassName MainController
 * @Date 2020/9/1 14:06
 * @Introduce
 */
@Controller
public class MainController {

//    @Autowired
//    private SenderMq senderMq;
    @Autowired
    private AlbumtypeMapper albumtypeMapper;
    @Autowired
    private PhotoMapper photoMapper;
    private static final String PREFIX = "user";
    /**
     * 首页
     * @return
     */
    @RequestMapping("/index")
    public String index(){
        Subject subject= SecurityUtils.getSubject();
        User user = (User) subject.getPrincipal();
        System.out.println(user);
//        senderMq.send();
        return "index";
    }


    /**
     * 登录页面
     * @return
     */
    @RequestMapping(value = "/login")
    public String login(){
        return "login";
    }

    /**
     * 手机登录页面
     * @return
     */
    @RequestMapping("/phone")
    public String phone(){
        return "phone";
    }

    /**
     * 注册页面
     * @return
     */
    @RequestMapping("/register")
    public String register(){
        return "register";
    }

    @RequestMapping("/testLogin")
    public String testLogin(){
        return "testLogin";
    }

    @RequestMapping("/userTable")
    public String userTable(){
        return PREFIX+"/table";
    }

}
